﻿#region Legal

// Jimmy Zimmerman
// Team Mongoose
//
// END USER LICENSE AGREEMENT
// IMPORTANT - READ THIS CAREFULLY:  This End User License Agreement is a legal agreement
// between you (either an individual, business entity, currently active identity of an
// individual with Multiple Personality Disorder, octopus overlord, or otherworldly entity),
// and Team Mongoose, for the enclosed, components.
//
// By reading this document and/or installing this product, you agree to be bound by the
// terms of this EULA.
//
// Team Mongoose owns all copyright, trade secret, trademark, trade wars,
// patent, portent, and potential rights to these components.  Team Mongoose
// grants you the right to deploy the enclosed components.
//
// If you agree to the terms of this EULA, a license to use these components is granted to you.
//
// If you should happen to benefit from the enclosed components, then you are legally and
// contractually bound to thank us for it. Send your regards to jimmyzimms@hotmail.com.
//
// OTHER RIGHTS AND LIMITATONS
// You may not reverse-engineer, decompile, decode, disassemble, psycho-analyze, or otherwise
// attempt to find hidden meanings between the lines of this EULA; unless, of course, you should
// happen to find some, and they are funny.
//
// You may not translate this EULA or any part of the components into Ancient Sumerian.
//
// THESE COMPONENTS ARE PROVIDED “AS-IS” WITHOUT WARRANTY OF ANY KIND. ANY USE OF THE COMPONENTS
// CONTAINED IS AT YOUR OWN RISK. TEAM MONGOOSE DISCLAIM ALL WARRANTIES, EITHER
// EXPRESS OR IMPLIED, WITH RESPECT TO THE ACCURRACY AND CORRECTNESS OF THE COMPONENTS CONTAINED
// HEREIN. TEAM MONGOOSE DOES NOT WARRANT THAT THE COMPONENTS ARE FLAWLESS.
//
// REDISTRIBUTION AND USE IN SOURCE AND BINARY FORMS, WITH OR WITHOUT MODIFICATION, ARE PERMITTED
// PROVIDED THAT THE FOLLOWING CONDITIONS ARE MET:
// * REDISTRIBUTIONS OF SOURCE CODE MUST RETAIN THE ABOVE COPYRIGHT NOTICE
// * REDISTRIBUTIONS IN BINARY FORM MUST NOTE THE USE OF THE COMPONENT IN DOCUMENTATION AND/OR
//   OTHER MATERIALS PROVIDED WITH THE DISTRIBUTION.
// * NEITHER THE NAME OF TEAM MONGOOSE MAY BE USED TO ENDORES OR PROMOTE PRODUCTS
//   DERIVED FROM THIS SOFTWARE WITHOUT SPECIFIC PRIOR WRITTEN PERMISSION.
//
// IN NO EVENT SHALL TEAM MONGOOSE BE HELD LIABLE FOR INCIDENTAL, SPECIAL, INDIRECT,
// INCONSEQUENTIAL, UNBELIEVABLE, EXAGGERATED, VERBOSE, OR TYPICAL DAMAGES INCURRED WHILE USING
// THE ENCLOSED COMPONENTS.
//
// OUR STUFF ALWAYS WORKS - SOMETIMES.

#endregion

using System;

namespace Mongoose.Games.BfgRoster
{
    /// <summary>
    /// Used to indicate the armor rating of a ship class for each of the cardinal directions.
    /// </summary>
    public class ArmorRating
    {
        #region Fields

        private readonly Int32 bow;
        private readonly Int32 port;
        private readonly Int32 starbord;
        private readonly Int32 stern;

        #endregion

        #region Constructors

        /// <summary>
        /// Initializes a new instance of the <see cref="ArmorRating"/> class with the supplied armor rating used symetically.
        /// </summary>
        /// <remarks>This constructor will set all 4 ratings to the supplied value.</remarks>
        /// <param name="rating">The armor rating to use.</param>
        /// <exception cref="ArgumentOutOfRangeException">A parameter value is less than 1.</exception>
        public ArmorRating(Int32 rating) : this(rating, rating)
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="ArmorRating"/> class with the specified bow rating.
        /// </summary>
        /// <remarks>This constructor will set the bow rating specifically and the remainder to the <paramref name="rating"/> value.</remarks>
        /// <param name="bowRating">The bow armor rating.</param>
        /// <param name="rating">The armor rating used for the remaining side/</param>
        /// <exception cref="ArgumentOutOfRangeException">A parameter value is less than 1.</exception>
        public ArmorRating(Int32 bowRating, Int32 rating) : this(bowRating, rating, rating, rating)
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="ArmorRating"/> class with each side specified.
        /// </summary>
        /// <param name="bowRating">The bow armor rating.</param>
        /// <param name="portRating">The port armor rating.</param>
        /// <param name="starboardRating">The starboard armor rating.</param>
        /// <param name="sternRating">The stern armor rating.</param>
        /// <exception cref="ArgumentOutOfRangeException">A parameter value is less than 1.</exception>
        public ArmorRating(Int32 bowRating, Int32 portRating, Int32 starboardRating, Int32 sternRating)
        {
            if (bowRating < 1) throw new ArgumentOutOfRangeException("bowRating");
            if (portRating < 1) throw new ArgumentOutOfRangeException("portRating");
            if (starboardRating < 1) throw new ArgumentOutOfRangeException("starboardRating");
            if (sternRating < 1) throw new ArgumentOutOfRangeException("sternRating");

            this.bow = bowRating;
            this.port = portRating;
            this.starbord = starboardRating;
            this.stern = sternRating;
        }

        #endregion

        #region Properties

        /// <summary>
        /// Gets or sets the bow armor rating.
        /// </summary>
        /// <value>The bow armor rating.</value>
        /// <exception cref="InvalidOperationException">The current instance is locked for modification.</exception>
        public virtual Int32 Bow
        {
            get { return this.bow; }
        }

        /// <summary>
        /// Gets or sets the port side armor rating.
        /// </summary>
        /// <value>The port side armor rating.</value>
        /// <exception cref="InvalidOperationException">The current instance is locked for modification.</exception>
        public virtual Int32 Port
        {
            get { return this.port; }
        }

        /// <summary>
        /// Gets or sets the starbord side armor rating.
        /// </summary>
        /// <value>The starbord side armor rating.</value>
        /// <exception cref="InvalidOperationException">The current instance is locked for modification.</exception>
        public virtual Int32 Starbord
        {
            get { return this.starbord; }
        }

        /// <summary>
        /// Gets or sets the stern armor rating.
        /// </summary>
        /// <value>The stern armor rating.</value>
        /// <exception cref="InvalidOperationException">The current instance is locked for modification.</exception>
        public virtual Int32 Stern
        {
            get { return this.stern; }
        }

        #endregion
    }
}
